<template>
  <div id="Table">
    <v-table
      :pageSize="pageSize"
      :page="page"
      :searchFlag="false"
      :tableConfig="tableConfig"
      :tableData="tableData"
      :total="total"
      @findData="getTableData"
      @getTableData="getTableData"
      @selectData="setSelectData"
      @setdialog="setdialog"
      @upData="getTableData"
      ref="table"
    ></v-table>
  </div>
</template>

<script>
import table from "commons/Table";
import baseMixin from "@/mixins/BaseMixin";

export default {
  name: "Table",
  mixins: [baseMixin],
  props: {
    data: {
      type: Object,
    },
  },
  data() {
    return {
      tableConfig: [
        {
          label: this.$t("bill.serial"),
          prop: "seq",
        },
        {
          label: this.$t("outbound.lottablereceiptvalidation", { no: "01" }),
          prop: "lottable01receiptvalidation",
        },
        {
          label: this.$t("outbound.lottablereceiptconversion", { no: "01" }),
          prop: "lottable01receiptconversion",
        },
        {
          label: this.$t("outbound.lottablereceiptvalidation", { no: "02" }),
          prop: "lottable02receiptvalidation",
        },
        {
          label: this.$t("outbound.lottablereceiptconversion", { no: "02" }),
          prop: "lottable02receiptconversion",
        },
        {
          label: this.$t("outbound.lottablereceiptvalidation", { no: "03" }),
          prop: "lottable03receiptvalidation",
        },
        {
          label: this.$t("outbound.lottablereceiptconversion", { no: "03" }),
          prop: "lottable03receiptconversion",
        },
        {
          label: this.$t("outbound.lottablereceiptvalidation", { no: "04" }),
          prop: "lottable04receiptvalidation",
        },
        {
          label: this.$t("outbound.lottablereceiptconversion", { no: "04" }),
          prop: "lottable04receiptconversion",
        },
        {
          label: this.$t("outbound.lottablereceiptvalidation", { no: "05" }),
          prop: "lottable05receiptvalidation",
        },
        {
          label: this.$t("outbound.lottablereceiptconversion", { no: "05" }),
          prop: "lottable05receiptconversion",
        },
        {
          label: this.$t("outbound.lottablereceiptvalidation", { no: "06" }),
          prop: "lottable06receiptvalidation",
        },
        {
          label: this.$t("outbound.lottablereceiptconversion", { no: "06" }),
          prop: "lottable06receiptconversion",
        },
        {
          label: this.$t("outbound.lottablereceiptvalidation", { no: "07" }),
          prop: "lottable07receiptvalidation",
        },
        {
          label: this.$t("outbound.lottablereceiptconversion", { no: "07" }),
          prop: "lottable07receiptconversion",
        },
        {
          label: this.$t("outbound.lottablereceiptvalidation", { no: "08" }),
          prop: "lottable08receiptvalidation",
        },
        {
          label: this.$t("outbound.lottablereceiptconversion", { no: "08" }),
          prop: "lottable08receiptconversion",
        },
        {
          label: this.$t("outbound.lottablereceiptvalidation", { no: "09" }),
          prop: "lottable09receiptvalidation",
        },
        {
          label: this.$t("outbound.lottablereceiptconversion", { no: "09" }),
          prop: "lottable09receiptconversion",
        },
        {
          label: this.$t("outbound.lottablereceiptvalidation", { no: "10" }),
          prop: "lottable10receiptvalidation",
        },
        {
          label: this.$t("outbound.lottablereceiptconversion", { no: "10" }),
          prop: "lottable10receiptconversion",
        },
      ],
      tableData: [],
      pageSize: 10,
      page: 1,
      total: 10,
    };
  },
  methods: {
    //获取table数据
    async getTableData(page, data) {
      data = {
        lottablevalidationkey: this.data.argument.lottablevalidationkey,
        curpage: page,
      };
      try {
        this.loading = true;
        let res = await this.$api.post(
          `/queryLottabledetail/${this.$store.state.wms}`,
          data
        );
        
          this.tableData = res.page.list;
          this.page = res.page.curpage;
          this.pageSize = res.page.pageSize;
          this.total = res.page.total;
        
      } catch (e) {
        this.$message.error(e);
      } finally {
        this.loading = false;
      }
    },
    //选中的数据
    setSelectData(data) {
      this.$parent.selectData = data;
    },
    //进入详情
    async setdialog(data) {
      this.$parent.enterDetails(data);
    },
  },
  mounted() {
    this.getTableData(1);
  },
  components: {
    "v-table": table,
  },
};
</script>

<style scoped></style>
